#include <bits/stdc++.h>
using namespace std;
//prime or not
bool isprime(int d)
{
    if (d == 2)
    {
        return true;
    }
    if (d <= 1)
    {
        return false;
    }
    for (int i = 2; i <= sqrt(d); i++)
    {
        if (d % i == 0)
        {
            return false;
        }
    }
    return true;
}
int main()
{
    int input;
    cin >> input;
    if (input <= 6)
    {
        if (isprime(input) && isprime(input + 6))
        {
            cout << "Yes" << endl;
            cout << input << endl;
            return 0;
        }
    }
    else
    {
        if (isprime(input))
        {
            if (isprime(input - 6))
            {
                cout << "Yes" << endl;
                cout << input - 6 << endl;
                return 0;
            }
            else if (isprime(input + 6))
            {
                cout << "Yes" << endl;
                cout << input + 6 << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    input++;
    while(1){
        if((isprime(input)&&isprime(input-6))||(isprime(input)&&isprime(input+6))){
            cout<<input<<endl;
            break;
        }
        input++;
    }
}
